//
//  Alter.swift
//  foreign_swift
//
//  Created by 黄敦仁 on 15/4/18.
//  Copyright (c) 2015年 hdr. All rights reserved.
//

import UIKit

struct Alter{
    static func showInfoButtom(vc:UIViewController,_ msg:String){
       
        let alterC =  UIAlertController(title: nil, message: msg, preferredStyle: UIAlertControllerStyle.Alert)
        let action  = UIAlertAction(title: "OK", style: UIAlertActionStyle.Cancel, handler: nil)
        alterC.addAction(action)
        vc.presentViewController(alterC, animated: true, completion: nil)
    }
    
    static func showLoading(vc:UIViewController, msg:String = "loading")->UIAlertController{
        let aiv = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.Gray)
        aiv.center = CGPoint(x: Const.screen_width_center,y: 0)
        
        let alterC =  UIAlertController(title: nil, message: msg, preferredStyle: UIAlertControllerStyle.Alert)
        alterC.view.addSubview(aiv)
        aiv.startAnimating()
        vc.presentViewController(alterC, animated: false, completion: nil)
        
        return alterC
    }

}